<script type="text/javascript">
    setTimeout(function(){
        jQuery(".chzn-select").chosen();
    },1);
</script>
<div class="breadcrumbwidget">
	<ul class="skins">
        <li><a href="default" class="skin-color default"></a></li>
        <li><a href="orange" class="skin-color orange"></a></li>
        <li>&nbsp;</li>
        <li class="fixed"><a href="" class="skin-layout fixed"></a></li>
        <li class="wide"><a href="" class="skin-layout wide"></a></li>
    </ul><!--skins-->
	<ul class="breadcrumb">
        <li><a href="<?php echo $baseurl?>">Trang chủ</a> <span class="divider">/</span></li>
        <li class="active">Thêm địa điểm</li>
    </ul>
</div><!--breadcrumbwidget-->
<div class="pagetitle">
	<h1>Thêm địa điểm</h1> <span></span>
</div>
<div class="maincontent">
    <?php if(validation_errors()):?>
        <div class="alert alert-error" style="margin: 10px 10px 10px 40px;">
          <button data-dismiss="alert" class="close" type="button">×</button>
          <?php echo validation_errors(); ?>
        </div>
    <?php endif;?>
    <div class="contentinner content-dashboard">    
    
    <p style="margin: 10px 5px 10px 0px;font-size: 18px;">
        Thông tin cơ bản
            <hr style="border-top: 1px soild #DCDCDC !important;margin: 0px;" />
    </p>
    <?php $attr = array('class' => 'stdform'); echo form_open_multipart('', $attr)?>
    
	<p>
    	<label>Chọn danh mục ( * )</label>
        <span class="formwrapper">
            <?php echo $fview->advancedSelectType($getCategories, $this->input->post('category_id'), 'category_id', 'Chọn 1 danh mục...');?>
        </span>
    </p>
	
    <p>
    	<label>Tên địa điểm ( * )</label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('name');?>" name="name" class="input-xxlarge name" placeholder="Tên địa điểm" /></span>
    </p>
    
	<p>
    	<label>Giới thiệu </label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('intro');?>" name="intro" class="input-xxlarge" placeholder="Giới thiệu" /></span>
    </p>
	
	<p>
    	<label>Mô tả </label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('description');?>" name="description" class="input-xxlarge" placeholder="Mô tả" /></span>
    </p>
	
	<p>
    	<label>Link website </label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('link');?>" name="link" class="input-xxlarge" placeholder="Link website" /></span>
    </p>
	
	<p>
    	<label>Địa chỉ ( * )</label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('address');?>" name="address" class="input-xxlarge address" onkeyup="" placeholder="Nhập địa chỉ nhà hàng" /></span>
    </p>
	
	<p>
    	<label>Vĩ độ - Latitude ( * )</label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('latitude');?>" name="latitude" id="lat" class="input-xxlarge" placeholder="Vĩ độ - Latitude" /></span>
    </p>
    
    <p>
    	<label>Kinh độ - Longitude ( * )</label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('longitude');?>" name="longitude" id="lng" class="input-xxlarge" placeholder="Kinh độ - Longitude" /></span>
    </p>
	
	<p>
    	<label>Số điện thoại </label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('phone');?>" name="phone" class="input-xxlarge" placeholder="Số điện thoại" /></span>
    </p>
	
	
	
	<p>
    	<label>Địa chỉ email </label>
        <span class="field"><input type="text" value="<?php echo $this->input->post('email');?>" name="email" class="input-xxlarge" placeholder="Địa chỉ email" /></span>
    </p>
	
    <p>
		<label>Ảnh đại diện (*)</label>
		<span class="field">
			<img src="" id="img_incens" style="display: inline-block; vertical-align: middle;width: 100px;height: 95px;border: 1px solid #CCC;background: #CCC;" />
			<input type="hidden" name="img_incens_hd_" id="img_incens_hd_" value="" />
			<input type="hidden" name="img_incens_verify" id="img_incens_verify" value="" />
			<input type="hidden" name="img_check" id="img_check" value="" />
			<input class="uniform-file" type="file" name="fileupload" id="img_incens_" onchange="convertimage('img_incens_', 'img_incens_hd_', 'img_incens', 'img_check');" value="" />
			( Ảnh png,jpg, Kích thước 640x427, tối đa 2Mb )
		</span>
	</p>
    
	<p>
    	<label>Trạng thái nổi bật (*)</label>
        <span class="field">
            <?php echo $fview->selectType(array('1' => 'Kích hoạt','0' => 'Hủy kích hoạt'), '0', 'favorite');?>
        </span>
    </p>
	
	<p>
    	<label>Trạng thái kích hoạt (*)</label>
        <span class="field">
            <?php echo $fview->selectType(array('1' => 'Kích hoạt','0' => 'Hủy kích hoạt'), '1', 'active');?>
        </span>
    </p>
	
    <p>
        <label></label>
        <button class="btn btn-rounded" type="submit"> <i class="iconfa-ok"></i> &nbsp; Lưu lại</button>
        <button class="btn btn-rounded" type="button" onclick="window.location='<?php echo $baseurl.'manage/categories/index'?>'"> <i class="icon-arrow-right"></i> &nbsp; Hủy bỏ</button>
    </p>
    
    </form>
	<!-- map -->
	  <div id="box-map" style="display: none;">
        <div align="center" id="map" style="width: 350px;height: 300px;position: absolute;top: 50%;right: 5px;z-index: 99999;background: #FFF;box-shadow: 0px 2px 6px #555;"><br/></div>
        <div class="close-map show_msg" >
            Đang tải ...
        </div>
        <div class="close-map" >
            [ Tắt ]
        </div>
    </div>
	<!-- END map -->
	
	
	
    </div>
</div>
<script>

function convertimage(id, id_parse, img_show)
{
    var id = id;
    var id_parse = id_parse;
    var img_show = img_show;
    var filesSelected = document.getElementById(id).files;
    if (filesSelected.length > 0)
    {
        var fileToLoad = filesSelected[0];

        var fileReader = new FileReader();

        fileReader.onload = function(fileLoadedEvent) 
        {
            $("#"+id_parse).attr('value', fileLoadedEvent.target.result);
            //document.getElementById('cddd').html(fileLoadedEvent.target.result);
            $("#"+img_show).attr('src', fileLoadedEvent.target.result);
        };

        fileReader.readAsDataURL(fileToLoad);
    }
}
</script>

<script>
$(function()
{
   $('.close-map').click(function()
   {
        $("#box-map").hide();
        checkpopup = 1;
   });
});
</script>
<style>
.close-map{
    width: 40px;position: absolute;top: 50%;right: 10px;z-index: 99999;background: #FFF;padding: 5px;cursor: pointer
}
.show_msg{
    right: 60px;width: 70px;
}
</style>